Skip to content

feat(ratelimiter): expose GET /info endpoint - #591

Merged
priyaselvaganesan merged 4 commits into
mainfrom
feat/version-endpoint-ratelimiter
Aug 7, 2026
Merged

feat(ratelimiter): expose GET /info endpoint#591
priyaselvaganesan merged 4 commits into
mainfrom
feat/version-endpoint-ratelimiter

Conversation

@priyaselvaganesan

@priyaselvaganesan priyaselvaganesan commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

TL;DR

Adds GET /info to the ratelimiter management HTTP server (port 8080, alongside /health), serving service name, version, and commit SHA via the shared go-lib handler.

Additional Details

  • cmd/main.go extracts newHealthServeMux so routes are unit-testable, then registers golibversion.Handler() at GET /info.
  • Service, Version, and GitHash x_defs are injected at build time (--stamp). GitHash uses {STABLE_GIT_COMMIT_FULL} so commit is the full 40-char SHA. Non-GET returns 405 (Allow: GET).
  • go.mod pins the merged go-lib (feat(go-lib/version): add Handler and HandlerFor http.Handler #270). Per Go MVS this also pulls go.opentelemetry.io/otel to v1.44 and related golang.org/x deps forward.

Testing

Built with Bazel from the monorepo root with stamping, imported into the local ncp-local k3d cluster, and verified via port-forward:

$ curl http://localhost:8080/info
{"service":"nvcf-ratelimiter","version":"mr-91dcf749","commit":"91dcf7493bf7d64d5a98e3398aecc5dee199b587"}

$ curl -X POST http://localhost:8080/info  ->  405 Method Not Allowed (Allow: GET)
$ curl http://localhost:8080/health        ->  200

In a CI release build version is the service release semver. /info is management-port-only; ratelimiter has no external ingress so it is in-cluster accessible only.

References

Relates to #315

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The ratelimiter management server now serves /info with build version metadata. Bazel injects service and Git metadata. The shared mux preserves /health behavior, and tests validate successful GET and rejected non-GET requests.

Changes

Ratelimiter management metadata

Layer / File(s) Summary
Build-time version metadata
src/invocation-plane-services/ratelimiter/go.mod, src/invocation-plane-services/ratelimiter/cmd/BUILD.bazel
The build links the service name, stable version, and full stable Git commit. Module dependency versions are updated.
Management mux and endpoint validation
src/invocation-plane-services/ratelimiter/cmd/main.go, src/invocation-plane-services/ratelimiter/cmd/info_test.go, src/invocation-plane-services/ratelimiter/cmd/BUILD.bazel
The shared mux serves /health and /info. Tests validate JSON metadata for GET and HTTP 405 responses for POST, PUT, and DELETE.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: famousdirector, max-nv

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title uses the required Conventional Commits format and accurately describes the new customer-facing GET /info endpoint.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/version-endpoint-ratelimiter

Comment @coderabbitai help to get the list of available commands.

@priyaselvaganesan
priyaselvaganesan marked this pull request as ready for review July 31, 2026 21:56
@priyaselvaganesan
priyaselvaganesan requested a review from a team as a code owner July 31, 2026 21:56

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/invocation-plane-services/ratelimiter/cmd/info_test.go (1)

44-50: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Verify metadata from the stamped binary.

These assertions accept "unknown" values. The tests can pass if the go_binary linker definitions are removed or use incorrect keys. Add a stamped-binary test that verifies the injected service, version, and commit values, or confirm that the repository’s go_test rule can apply equivalent x_defs.

As per coding guidelines, “Code changes must include tests.” Based on learnings, use the repository-native test runner for build and test rules.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/invocation-plane-services/ratelimiter/cmd/info_test.go` around lines 44 -
50, Strengthen the metadata test around the stamped binary response so it
verifies the expected injected service, version, and commit values rather than
merely checking non-empty fields or allowing "unknown". Use the
repository-native build/test runner and either add a stamped-binary test or
configure the go_test rule with equivalent x_defs, ensuring the assertions
detect missing or incorrect linker keys.

Sources: Coding guidelines, Learnings

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/invocation-plane-services/ratelimiter/cmd/main.go`:
- Around line 143-156: Wrap the management mux returned by newHealthServeMux
before passing it to http.ListenAndServe using the established HTTP telemetry
middleware. Configure stable service.operation names for /health and /info, and
enable the Prometheus integration to export failed-request status attributes
while preserving the existing handlers and responses.

---

Nitpick comments:
In `@src/invocation-plane-services/ratelimiter/cmd/info_test.go`:
- Around line 44-50: Strengthen the metadata test around the stamped binary
response so it verifies the expected injected service, version, and commit
values rather than merely checking non-empty fields or allowing "unknown". Use
the repository-native build/test runner and either add a stamped-binary test or
configure the go_test rule with equivalent x_defs, ensuring the assertions
detect missing or incorrect linker keys.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 8927bec0-9b1a-48fb-aa1e-9e1bef6582c1

📥 Commits

Reviewing files that changed from the base of the PR and between 4311bd1 and a54c2fa.

⛔ Files ignored due to path filters (1)
  • src/invocation-plane-services/ratelimiter/go.sum is excluded by !**/*.sum
📒 Files selected for processing (5)
  • src/invocation-plane-services/ratelimiter/cmd/BUILD.bazel
  • src/invocation-plane-services/ratelimiter/cmd/info_test.go
  • src/invocation-plane-services/ratelimiter/cmd/main.go
  • src/invocation-plane-services/ratelimiter/go.mod
  • src/invocation-plane-services/ratelimiter/tools/workspace_status.sh

Comment thread src/invocation-plane-services/ratelimiter/cmd/main.go
@priyaselvaganesan priyaselvaganesan self-assigned this Jul 31, 2026
@priyaselvaganesan
priyaselvaganesan marked this pull request as draft July 31, 2026 22:11
@priyaselvaganesan
priyaselvaganesan force-pushed the feat/version-endpoint-ratelimiter branch from a54c2fa to 36253c1 Compare August 5, 2026 22:54
@priyaselvaganesan
priyaselvaganesan marked this pull request as ready for review August 5, 2026 23:01
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@priyaselvaganesan
priyaselvaganesan force-pushed the feat/version-endpoint-ratelimiter branch from dd8fa06 to 91dcf74 Compare August 6, 2026 18:41
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/invocation-plane-services/ratelimiter/cmd/info_test.go (2)

58-66: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Expand the non-GET method coverage.

The table checks only POST, PUT, and DELETE. Add standard methods such as HEAD, PATCH, and OPTIONS to detect method-specific regressions. The /info contract requires 405 Method Not Allowed, Allow: GET, and an empty body for non-GET requests.

As per PR objectives, non-GET requests to /info must return 405 Method Not Allowed with Allow: GET.

Suggested test expansion
-		for _, method := range []string{http.MethodPost, http.MethodPut, http.MethodDelete} {
+		for _, method := range []string{
+			http.MethodHead,
+			http.MethodPost,
+			http.MethodPut,
+			http.MethodPatch,
+			http.MethodDelete,
+			http.MethodOptions,
+		} {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/invocation-plane-services/ratelimiter/cmd/info_test.go` around lines 58 -
66, Expand the non-GET method table in the `/info` handler test to include
`HEAD`, `PATCH`, and `OPTIONS` alongside the existing methods. Preserve
assertions that every listed method returns `405 Method Not Allowed`, `Allow:
GET`, and an empty response body.

44-50: 🗄️ Data Integrity & Integration | 🔵 Trivial | 🏗️ Heavy lift

Add a Bazel test for build-time metadata.

x_defs is configured only on cmd, while cmd_test embeds cmd_lib. The current assertions therefore accept "unknown" and do not validate the service name, version, or full commit SHA. Add an integration test with known service, version, and full commit values, and retain this unit test for fallback behavior.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/invocation-plane-services/ratelimiter/cmd/info_test.go` around lines 44 -
50, Add a Bazel integration test for the ratelimiter info command that supplies
known build-time x_defs values and asserts the exact service name, version, and
full commit SHA in the response. Keep the existing test in the info command test
flow focused on fallback behavior, including its non-empty assertions for
unresolved metadata.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/invocation-plane-services/ratelimiter/cmd/info_test.go`:
- Around line 58-66: Expand the non-GET method table in the `/info` handler test
to include `HEAD`, `PATCH`, and `OPTIONS` alongside the existing methods.
Preserve assertions that every listed method returns `405 Method Not Allowed`,
`Allow: GET`, and an empty response body.
- Around line 44-50: Add a Bazel integration test for the ratelimiter info
command that supplies known build-time x_defs values and asserts the exact
service name, version, and full commit SHA in the response. Keep the existing
test in the info command test flow focused on fallback behavior, including its
non-empty assertions for unresolved metadata.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 1a121bc7-3186-498b-b889-8be607469861

📥 Commits

Reviewing files that changed from the base of the PR and between 85d2af4 and 44f70c3.

⛔ Files ignored due to path filters (1)
  • src/invocation-plane-services/ratelimiter/go.sum is excluded by !**/*.sum
📒 Files selected for processing (4)
  • src/invocation-plane-services/ratelimiter/cmd/BUILD.bazel
  • src/invocation-plane-services/ratelimiter/cmd/info_test.go
  • src/invocation-plane-services/ratelimiter/cmd/main.go
  • src/invocation-plane-services/ratelimiter/go.mod
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/invocation-plane-services/ratelimiter/go.mod
  • src/invocation-plane-services/ratelimiter/cmd/main.go
  • src/invocation-plane-services/ratelimiter/cmd/BUILD.bazel

@priyaselvaganesan
priyaselvaganesan force-pushed the feat/version-endpoint-ratelimiter branch 2 times, most recently from f101a07 to 89ac3ec Compare August 7, 2026 17:03
@priyaselvaganesan priyaselvaganesan changed the title feat(ratelimiter): expose GET /info endpoint feat(ratelimiter): expose GET /info endpoint Aug 7, 2026
@priyaselvaganesan
priyaselvaganesan force-pushed the feat/version-endpoint-ratelimiter branch from 89ac3ec to 0aac1b5 Compare August 7, 2026 18:21
Signed-off-by: priyaselvaganesan <pselvaganesa@nvidia.com>
…test

Signed-off-by: priyaselvaganesan <pselvaganesa@nvidia.com>
…rtions

Signed-off-by: priyaselvaganesan <pselvaganesa@nvidia.com>
@priyaselvaganesan
priyaselvaganesan force-pushed the feat/version-endpoint-ratelimiter branch from 0aac1b5 to 1199228 Compare August 7, 2026 18:22
@priyaselvaganesan
priyaselvaganesan added this pull request to the merge queue Aug 7, 2026
Merged via the queue into main with commit 2d4a828 Aug 7, 2026
18 checks passed
@priyaselvaganesan
priyaselvaganesan deleted the feat/version-endpoint-ratelimiter branch August 7, 2026 19:05
@balajinvda

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version nvcf-ratelimiter-v1.17.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants